/** 统计相关的请求 */
import request from '@/utils/request'

export function top5ActEquip(id) {
  return request({
    url: 'dashboard/top5ActEquip/' + id,
    method: 'get'
  })
}

export function top5Alarm(id) {
  return request({
    url: 'dashboard/top5Alarm/' + id,
    method: 'get'
  })
}

export function realStateCount(id) {
  return request({
    url: 'dashboard/realStateCount/' + id,
    method: 'get'
  })
}

export function etypeGroupCount(id) {
  return request({
    url: 'dashboard/etypeGroupCount/' + id,
    method: 'get'
  })
}

export function top5ActName(id) {
  return request({
    url: 'dashboard/top5ActName/' + id,
    method: 'get'
  })
}

export function lastDayDatas(ids) {
  return request({
    url: 'iotEquipData5mins/lastDay/' + ids,
    method: 'post'
  })
}

export function getEquipData(id, startTime, endTime) {
  let queryStr = "?xx=1";
  if (startTime) {
    queryStr += "&startTime=" + startTime
  }
  if (endTime) {
    queryStr += "&endTime=" + endTime
  }  

  return request({
    url: 'iotEquipDatas/hisdata/' + id + queryStr,
    method: 'get'
  })
}



export default { top5ActEquip, top5Alarm, realStateCount, etypeGroupCount, top5ActName, lastDayDatas, getEquipData}

